package edu.friday_2025_04_27.controller;

import edu.friday_2025_04_27.common.base.BaseController;
import edu.friday_2025_04_27.common.result.RestResult;
import edu.friday_2025_04_27.common.result.TableDataInfo;
import edu.friday_2025_04_27.model.vo.SysUserVO;
import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

@RestController
@RequestMapping("/demo")
public class DemoController extends BaseController {

    @GetMapping(value = {"/","{userId}"})
    public RestResult getInfo(@PathVariable(value = "userId",required = false)Long userId){
        RestResult ajax = RestResult.success();
        ajax.put("userId",userId);
        return ajax;
    }

    @GetMapping("/list")
    public TableDataInfo list(){
        ArrayList<String> list = new ArrayList<>();
        list.add("a");
        list.add("b");
        list.add("c");
        list.add("d");
        return TableDataInfo.success(list,100);
    }

    @GetMapping("/valid")
    public RestResult valid(SysUserVO sysUserVO){
        return RestResult.success();
    }
}
